package io.renren.hd.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.renren.dao.MongoDBGeneratorDao;
import io.renren.factory.MongoDBCollectionFactory;
import io.renren.hd.pojo.GenConfig;
import io.renren.hd.mapper.GenConfigMapper;
import io.renren.hd.service.GenConfigService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.utils.PageUtils;
import io.renren.utils.Query;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author LiuZhen
 * @since 2022-04-23
 */
@Service
public class GenConfigServiceImpl extends ServiceImpl<GenConfigMapper, GenConfig> implements GenConfigService {

    @Override
    public PageUtils queryList(Query query) {
        Page<?> page = PageHelper.startPage(query.getPage(), query.getLimit());
        List<GenConfig> list = baseMapper.selectList(null);
        int total = (int) page.getTotal();
        return new PageUtils(list, total, query.getLimit(), query.getPage());
    }
}
